//
//  BuyVC.m
//  OpenEyes
//
//  Created by dllo on 15/9/16.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "BuyVC.h"


@interface BuyVC ()<UIWebViewDelegate>

@property (nonatomic, strong) UIWebView *webView;
@property (nonatomic, strong) MBProgressHUD *HUD;
@end

@implementation BuyVC


-(void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
}


-(void)viewWillDisappear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"店铺";
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT + 44)];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.getBuyUrl]];
    [self.webView setDelegate:self];
    [self.webView loadRequest:request];
    [self.view addSubview:self.webView];
    

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"fanhui-3.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(left)];
    
}
-(void)left{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)webViewDidStartLoad:(UIWebView *)webView
{
    self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    self.HUD.removeFromSuperViewOnHide = YES;
    self.HUD.labelText = @"loading.....";
   
    [self.view addSubview:self.HUD];
    self.HUD.mode = MBProgressHUDModeIndeterminate;
    
    
    
}


- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.HUD setHidden:YES];
}


- (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    
    [self.HUD setHidden:YES];
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
